#ifndef CGAME_H
#define CGAME_H

#include "NetworkManager.h"

#include <list>
#include <map>
using namespace std;

#include "UTimer.h"
#include "hDataTypes.h"
#include "ObjectManager.h"

#define MAX_CLIENT_COUNT 256

class CGame
{
private:

	struct sClient
	{
		bool			active;
		unsigned int	lastSequence;
		float			time;

		SOCKADDR_IN		address;

		sClient() 
		{
			active = false;
			time = 0.0f;
		}
	};

	// Incrementals
	unsigned int m_nFrames;
	int m_nIDCounter;
	
	// Timing
	UTimer m_timeCore;
	float m_fTimeStep;

	// Objects
	map< unsigned int, unsigned int > m_umClientRobots;
	ObjectManager m_omObjects;

	//Networking
	NetworkManager m_nmNetwork;
	int m_nLastClientCount;

public:

	void Init();
	bool Run();
	void Shutdown();

private:

	void processMessage( char* _message, int sender );
	void ModRobots();
	void SendRobots();
};

#endif